<template>
  <div id="app">
    <Header />
    <main class="main-content" :class="{ 'no-padding': isHomePage }">
      <router-view v-slot="{ Component }">
        <transition name="fade" mode="out-in">
          <component :is="Component" />
        </transition>
      </router-view>
    </main>
    <Footer />
  </div>
</template>

<script>
import Header from "@/components/Header.vue";
import Footer from "@/components/Footer.vue";
import { computed } from 'vue'
import { useRoute } from 'vue-router'

export default {
  name: "App",
  components: {
    Header,
    Footer,
  },
  setup() {
    const route = useRoute()
    const isHomePage = computed(() => route.name === 'Home')
    return {
      isHomePage
    }
  }
};
</script>

<style>
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding-top: var(--header-height);
}

.main-content.no-padding {
  padding-top: 0;
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

@media (max-width: 768px) {
  .main-content {
    padding-top: var(--header-height-mobile);
  }
}
</style>
